<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="6" :xs="24">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>{{ $t('personalInfo') }}</span>
          </div>
          <div>
            <div class="text-center">
              <userAvatar />
            </div>
            <ul class="list-group list-group-striped">
              <li class="list-group-item">
                <svg-icon icon-class="user" /> {{ $t('username') }}
                <div class="pull-right">{{ username }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="user" /> {{ $t('user_name') }}
                <div class="pull-right">{{ name }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="email" /> {{ $t('userEmail') }}
                <div class="pull-right">{{ email }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="peoples" /> {{ $t('role') }}
                <div class="pull-right">{{ role_list }}</div>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18" :xs="24">
        <el-card>
          <div slot="header" class="clearfix">
            <span>{{ $t('basicInfo') }}</span>
          </div>
          <el-tabs v-model="activeTab">
            <el-tab-pane :label="$t('changePassword')" name="resetPwd">
              <resetPwd />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import userAvatar from './components/userAvatar.vue';
import resetPwd from './components/resetPwd';
import { mapGetters } from 'vuex';

export default {
  name: 'Profile',
  components: { userAvatar, resetPwd },
  data() {
    return {
      activeTab: 'resetPwd'
    };
  },
  computed: {
    ...mapGetters(['username', 'name', 'email', 'role_list'])
  }
};
</script>
